package com.easygoods.controller;

import com.bestvike.stone.core.lang.Environment;
import com.bestvike.stone.spring.controller.BaseController;
import com.bestvike.stone.spring.mail.bugreport.BugReportLevel;
import com.bestvike.stone.spring.mail.bugreport.BugReportUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 命令行控制器
 * Created by 许崇雷 on 2017-12-25.
 */
@RestController
public class ReportController extends BaseController {
    @PostMapping(value = "/api/bug/report")
    public void report(@RequestBody String content) {
        StringBuilder builder = new StringBuilder("客户端错误报告");
        builder.append(Environment.NewLine);
        builder.append(content);
        String msg = builder.toString();
        this.log.warn(msg);
        BugReportUtils.sendAsync(BugReportLevel.WARN, msg);
    }
}
